from gm.api import *
import talib
import numpy as np
import matplotlib.pyplot as plt

set_token('90be3f863b23ab3c1ef68d1f9b8dc06e4bebb30d')

data = history_n(symbol="SZSE.399006",
                 frequency='1d',
                 count=500,
                 end_time='2018-12-31',
                 fields='high,low,close,open,volume',
                 fill_missing='last',
                 adjust=ADJUST_PREV,
                 df=True
                 )

close = np.asarray(data['close'].values)#.astype(np.double)
open = np.asarray(data['open'].values)
high = np.asarray(data['high'].values)
low = np.asarray(data['low'].values)
volume = np.asarray(data['volume'].values).astype(np.double)

cdl2crows = talib.CDL2CROWS(high, low, close, volume)

print(cdl2crows)
